1 Public Class FrmADDSUPPLIER_ITEM
2
3     Private Sub cmdcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcancel.Click
4         Me.Close()
5     End Sub
6
7     Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
8         Dim i As Integer
9         With FrmAddSupplier.lstProducts
10
11         End With
12         
' With FrmAddSupplier.lstProducts
13         
' .Items.Add(lstItems.Items(i).Text)
14         
' End With
15         
' For x = 0 To FrmAddSupplier.lstProducts.Items.Count - 1
16         
' FrmAddSupplier.lstProducts.Items(x).SubItems.Add(lstItems.Items(i).SubItems(1).Text)
17         
' Next
18         If txtid.Text =
"" Then
19             MsgBox(
"Cannot save this record, select an item first ", MsgBoxStyle.Information, "Sales and Inventory")
20             Exit Sub
21         End If
22         With FrmAddSupplier
23             For i =
0 To .lstProducts.Items.Count - 1
24                 If .lstProducts.Items(i).SubItems(
1).Text = txtid.Text Then
25                     MsgBox(
"Selected item is already on the list !!", MsgBoxStyle.Exclamation, "Sales and Inventory")
26                     Exit Sub
27                 End If
28             Next
29             .lstProducts.Items.Add(txtcategory.Text)
30             .lstProducts.Items(.lstProducts.Items.Count -
1).SubItems.Add(txtid.Text)
31             .lstProducts.Items(.lstProducts.Items.Count -
1).SubItems.Add(txtname.Text)
32             .lstProducts.Items(.lstProducts.Items.Count -
1).SubItems.Add(txtprice.Text)
33             If MsgBox(
"Do you want to add new record ?", MsgBoxStyle.YesNo + MsgBoxStyle.Information, "Sales and Inventory") = MsgBoxResult.Yes Then
34                 FrmCATEGORYSELECTitem.ShowDialog()
35             Else
36                 Me.Close()
37             End If
38         End With
39     End Sub
40
41     Private Sub FrmADDSUPPLIER_ITEM_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
42         FrmCATEGORYSELECTitem.ShowDialog()
43         txtprice.Select()
44         txtprice.Focus()
45     End Sub
46 End Class


Gõ tìm kiếm nhanh...